package com.jyh.service.impl;

import com.jyh.service.BatchBuyService;
import com.jyh.service.BookShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/14 17:44
 */
@Service
public class BatchBuyServiceImpl implements BatchBuyService {
    @Autowired
    private BookShopService bookShopService;

    @Transactional
    public void buy(List<String> isbns, String username) {
        for (String isbn : isbns) {
            bookShopService.purchase(isbn,username);
        }
    }
}
